﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Moki.Tests.Model
{
    public interface IChangable
    {
        event EventHandler Changed;
        void RaiseChanged();
    }

    public interface ISubscriber
    {
        void OnChanged(object sender, EventArgs e);
    }

    public interface IStatus
    {
        event EventHandler Changed;
        void RaiseChanged();
        void OnChanged(object sender, EventArgs e);
    }

    public class Status : IChangable, IStatus
    {
        private bool changed = false;

        public event EventHandler Changed;

        public void RaiseChanged()
        {
            if (Changed != null)
                Changed(this, EventArgs.Empty);

            changed = true;
        }

        public void OnChanged(object sender, EventArgs e)
        {
            changed = true;
        }
    }

    public interface IView
    {
        event EventHandler Load;
    }

    public class Presenter
    {
        public bool OnLoadCalled = false;

        public Presenter(IView view)
        {
            view.Load += OnLoad;
        }

        private void OnLoad(object sender, EventArgs e)
        {
            OnLoadCalled = true;
            //the code that we would like to test
        }

        public void RaiseLoad()
        {

        }
    }
}
